1. Field of the Invention
The present invention generally relates to data processing and, more particularly, to processing database query results.
2. Description of the Related Art
Databases are computerized information storage and retrieval systems. A relational database management system is a computer database management system (DBMS) that uses relational techniques for storing and retrieving data. The most prevalent type of database is the relational database, a tabular database in which data is defined so that it can be reorganized and accessed in a number of different ways. A distributed database is one that can be dispersed or replicated among different points in a network. An object-oriented programming database is one that is congruent with the data defined in object classes and subclasses.
Regardless of the particular architecture, a DBMS can be structured to support a variety of different types of operations. Such operations can be configured to retrieve, add, modify and delete information being stored and managed by the DBMS. Standard database access methods support these operations using high-level query languages, such as the Structured Query Language (SQL). The term “query” refers to a set of words, phrases, or groups of words characterizing the data that a user may want to retrieve from a database.
Any requesting entity, including applications, operating systems and, at the highest level, users, can issue queries against data in a database to obtain required information. Queries may be predefined (i.e., hard coded as part of an application) or generated in response to input (e.g., user input). After a query is executed, a query result is returned to the requesting entity. The requesting entity may wish to invoke further routines to analyze the data included in the query result.
However, query results are typically returned in a format useful for presenting and displaying the results to a user. For example, query results are often returned as an HTML or XML document, or even more simply, a text-file of comma separated values. In this format, markup tags may be used to render a display of the query result as a table with the one or more rows. In some cases, a given cell of such a table may itself include multiple data elements. For instance, a cell of a row of such a result table may include multiple data elements or values. Within such a row, data from one cell may have a one-to-many relationship with data elements in the cell that contains multiple data elements. Further, if multiple cells within a row contain multiple elements many-to-many relationships may exist for elements in such a row. However, when returned in as an HTML or XML document, (among other formats), the query results are not returned in manner that preserves the relational nature of the query results. For example, elements from multiple database rows may be formatted and displayed as a single text string in a single row of a result table. Thus, the referential integrity of the data is lost. This referential integrity, however, is required for programmatic access by routines configured to analyze the data from the table. Accordingly, the referential integrity needs to be recreated to allow such a programmatic access.
Therefore, there is a need for an efficient technique for providing programmatic access and retrieval of relational data within a result set where cells may include elements from multiple database rows.